The present invention relates to a method of data management, and more particularly, to a method and a system for managing data from a host to an optical disc.
In Microsoft Windows FAT32 file system, write commands are transmitted by a host to the DVD-RAM (Digital Versatile Disc Random Access Memory) disc with random LBA (Logic Block Address) sequence. In other words, data of sequential write commands from the host may be write-address-discontinuous. The “write-address-discontinuous” here means that two data written into the disc and their ECC LBA are discontinuous. Similarly, “write-address-continuous” means that two data written into the disc and their ECC LBA are continuous. For example, a first data is needed to be written into the disc at ECC LBA 00DA34-00DA53, and when a second data is needed to be written into the disc at an ECC LBA 00DA54-XXXXXX, the second data and the first data are write-address-continuous; otherwise the second data and the first data are write-address-discontinuous.
For an optical storage system having a single write buffer mechanism, when the data of sequential write commands from the host is write-address-continuous, these data are temporally stored into the write buffer, and when a size of the data stored in the write buffer satisfies a predetermined value, the stored data are written to the optical disc.
However, when the data of incoming write commands from the host is write-address-discontinuous with the data stored in the write buffer, the data stored in the write buffer needs to be written to the optical disc no matter whether the size of the data exceeds the predetermined value or not, and then the data of a next write command is stored into the write buffer.
Please refer to FIG. 1. FIG. 1 is a diagram illustrating sequential write commands whose data are write-address-discontinuous. As shown in FIG. 1, five write commands CMD1-CMD5 are sequentially transmitted from the host to the write buffer, where two adjacent write commands are write-address-discontinuous.
Furthermore, beginning write addresses of the data of write commands CMD1-CMD5 are not aligned with ECC blocks as showed in FIG. 2. FIG. 2 is a diagram illustrating the write commands and ECC blocks related to the ECC LBAs of the data of the write commands shown in FIG. 1. Referring to FIG. 1 and FIG. 2 together, in the operations of the data written to the optical disc, because the data of any two write commands are write-address-discontinuous, before the data of each write commands CMD2-CMD5 is stored into the write buffer, what is stored in the write buffer (data of write commands CMD1-CMD4) needs to be written into the optical disc, therefore, it needs to write data into the optical disc at least four times.
In addition, because the beginning write addresses of the data of write commands CMD1-CMD5 are not aligned with ECC blocks, when the data of each write command CMD2-CMD5 needs to be written into the optical disc, a tail of the previous write-address-continuous data needs to be read from the optical disc first. For example, when the data of write command CMD3 needs to be written into the optical disc, a tail (i.e., address 00DA50-00DA54) is read from the optical disc, and then, this tail and the data of the write command CMD3 are written into the optical disc. Therefore, in FIG. 1, it needs to read the tails of the previous write-address-continuous data from the optical disc five times.
As mentioned above, before writing CMD1-CMD5 into the optical disc, the data which has been written on the optical disc needs to be read out, and then written into the optical disc again. Therefore, the related art method of writing data into the optical disc is inefficient.